﻿Public Class UCGestionEmploye
    'Permet l'ajout, la suppression, et la consultation des congés
    Private Sub GestionConge(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAjouter.Click, BtnEnlever.Click, LstConge.SelectedIndexChanged
        Select Case sender.name
            Case "BtnAjouter"
                If Not TxtRaison.Text = "" AndAlso Not DtpJourDebut.Value < Now AndAlso DtpJourDebut.Value < DtpJourFin.Value Then

                    If DtpHeureDebut.Checked = True Then
                        LstConge.Items.Add(TxtRaison.Text & " " & DtpJourDebut.Value.Date & " " & DtpHeureDebut.Value.TimeOfDay.ToString.Substring(0, 8))
                    Else
                        LstConge.Items.Add(TxtRaison.Text & " " & DtpJourDebut.Value.Date)
                    End If
                    'Ajouter le congé à la BD
                    TxtRaison.Text = ""
                    DtpJourDebut.Value = Now
                    DtpJourFin.Value = Now
                    DtpHeureDebut.Value = Now
                    DtpHeureFin.Value = Now
                    DtpHeureDebut.Checked = False
                    DtpHeureFin.Checked = False
                End If
            Case "BtnEnlever"
                If Not LstConge.SelectedIndex = -1 Then
                    LstConge.Items.RemoveAt(LstConge.SelectedIndex)
                    'Enlever le congé de la BD
                End If

            Case "lstConge"
                If Not Not LstConge.SelectedIndex = -1 Then
                    'Remplir les champs avec les données de la BD

                Else

                    TxtRaison.Text = ""
                    DtpJourDebut.Value = Now
                    DtpJourFin.Value = Now
                    DtpHeureDebut.Value = Now
                    DtpHeureFin.Value = Now
                    DtpHeureDebut.Checked = False
                    DtpHeureFin.Checked = False

                End If
        End Select

    End Sub

    'Permet l'ajout, la suppression, et la consultation des intérêts
    Private Sub GestionInteret(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAInterets.Click, BtnEInterets.Click
        Select Case sender.name
            Case "BtnAInterets"
                If Not CboInterets.Text = "" Then
                    LstInterets.Items.Add(CboInterets.Text)

                    CboInterets.Text = ""
                End If
            Case "BtnEInterets"
                If Not LstInterets.SelectedIndex = -1 Then
                    LstInterets.Items.RemoveAt(LstInterets.SelectedIndex)
                    'Enlever l'interet de la BD
                End If

        End Select

    End Sub

End Class
